class_name PotionDatabase
extends RefCounted

# 药水数据库
static var potions: Dictionary = {}

static func initialize():
	_create_potions()

static func _create_potions():
	# 777感冒灵 - 恢复生命值
	potions["cold_medicine"] = ColdMedicinePotion.new()
	
	# 糖水 - 获得能量
	potions["sugar_water"] = SugarWaterPotion.new()
	
	# 可乐 - 抽牌
	potions["cola"] = ColaPotion.new()
	
	# 香蕉 - 获得护甲
	potions["banana"] = BananaPotion.new()
	
	# 酒 - 增加攻击力
	potions["wine"] = WinePotion.new()

static func get_potion(potion_id: String) -> Potion:
	if potions.has(potion_id):
		return potions[potion_id]
	return null

# 具体药水实现
class ColdMedicinePotion extends Potion:
	func _init():
		super._init("cold_medicine", "777感冒灵", "恢复15点生命值", GameData.PotionType.COLD_MEDICINE)
	
	func on_use():
		var game_data = GameData.get_instance()
		game_data.player_health = min(game_data.player_health + 15, game_data.player_max_health)

class SugarWaterPotion extends Potion:
	func _init():
		super._init("sugar_water", "糖水", "获得2点能量", GameData.PotionType.SUGAR_WATER)
	
	func on_use():
		var game_data = GameData.get_instance()
		game_data.player_energy += 2

class ColaPotion extends Potion:
	func _init():
		super._init("cola", "可乐", "抽3张牌", GameData.PotionType.COLA)
	
	func on_use():
		var game_data = GameData.get_instance()
		for i in 3:
			game_data.draw_cards_to_hand()

class BananaPotion extends Potion:
	func _init():
		super._init("banana", "香蕉", "获得10点护甲", GameData.PotionType.BANANA)
	
	func on_use():
		var game_data = GameData.get_instance()
		# 护甲系统需要额外实现
		game_data.player_health += 10  # 临时用生命值代替护甲

class WinePotion extends Potion:
	func _init():
		super._init("wine", "酒", "本回合所有攻击伤害+5", GameData.PotionType.WINE)
	
	func on_use():
		# 攻击力加成需要状态系统支持
		pass
